local yiguo = fk.CreateSkill{
  name = "lingling__yiguo",
}

Fk:loadTranslationTable{
  ["lingling__yiguo"] = "役国",
  [":lingling__yiguo"] = "出牌阶段限一次，你可以观看并获得一名其他角色一张牌，其可以先失去1点体力摸三张牌。",

  ["#lingling__yiguo"] = "役国：观看并获得一名角色一张牌，其可以先失去1点体力摸三张牌",
  ["#lingling__yiguo-invoke"] = "役国：%src 即将获得你的一张牌，是否先失去1点体力摸三张牌？",
}

yiguo:addEffect("active", {
  anim_type = "offensive",
  prompt = "#lingling__yiguo",
  card_num = 0,
  target_num = 1,
  can_use = function(self, player)
    return player:usedSkillTimes(yiguo.name, Player.HistoryPhase) == 0
  end,
  card_filter = Util.FalseFunc,
  target_filter = function(self, player, to_select, selected)
    return #selected == 0 and to_select ~= player and not to_select:isNude()
  end,
  on_use = function(self, room, effect)
    local player = effect.from
    local target = effect.tos[1]
    if room:askToSkillInvoke(target, {
      skill_name = yiguo.name,
      prompt = "#lingling__yiguo-invoke:"..player.id,
    }) then
      room:loseHp(target, 1, yiguo.name)
      if target.dead then return end
      target:drawCards(3, yiguo.name)
      if target.dead or target:isNude() then return end
    end
    local cards_data = {}
    if not target:isKongcheng() then
      table.insert(cards_data, { "$Hand", target:getCardIds("h") })
    end
    if #target:getCardIds("e") then
      table.insert(cards_data, { "$Equip", target:getCardIds("e") })
    end
    local card = room:askToChooseCard(player, {
      target = target,
      flag = { card_data = cards_data },
      skill_name = yiguo.name,
    })
    room:moveCardTo(card, Card.PlayerHand, player, fk.ReasonPrey, yiguo.name, nil, false, player)
  end,
})

return yiguo
